package com.dynamic.sync.toolkit.mongo.sync.request;

import com.dynamic.sync.toolkit.EnvType;
import java.util.List;
import lombok.Data;
import org.apache.commons.collections4.CollectionUtils;

/**
 * @author ZonLen since on 2021/6/19 下午10:01
 */
@Data
public abstract class SyncFromEnvReq {

  private List<String> groupPrimaryKey;

  private String targetEnv;

  private String collectionName;

  private String documentName;

  public abstract EnvType targetEnv();

  public List<String> getGroupPrimaryKey() {
    if (CollectionUtils.isEmpty(groupPrimaryKey)){
      throw new RuntimeException("同步必须有业务唯一主键");
    }
    return groupPrimaryKey;
  }

}
